# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: psykose <alice@ayaya.dev>
pkgname=intel-gmmlib
pkgver=22.1.5
pkgrel=0
pkgdesc="Intel Graphics Memory Management Library"
options="!check" # tests can't run in check(), only on install
url="https://github.com/intel/gmmlib/"
arch="aarch64 x86_64 x86"
license="MIT"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/intel/gmmlib/archive/intel-gmmlib-$pkgver.tar.gz"
builddir="$srcdir/gmmlib-intel-gmmlib-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	# BUILD_TYPE is a separate type for another thing internally,
	# and only takes release
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_TYPE=Release \
		-DRUN_TEST_SUITE=OFF \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
1786d397d3a3d5303faec68a6eecb3426391c906ec16b47bd16462732e911928b3a9e7df2a84b384cf4c1b9dcb293953dcd11ee32a2fb631570db260b15f9c3b  intel-gmmlib-22.1.5.tar.gz
"
